﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Falcon System - Catálogo Online</title>
    <link href="Css/metro-bootstrap.css" rel="stylesheet" />
    <link href="Css/FalconSystemCatalogStyles.css" rel="stylesheet" />
    <script src="Javascript/jquery-1.11.1.min.js"></script>
    <script src="Javascript/Custom.js"></script>
    <link rel="icon" href="Template/falcon.ico" />
        
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">

                var oWndloginOut = null;

                // Timer date
                function timer_Datetime() {
                    mytime = setTimeout('display_Datetime()', 1000)
                }

                function display_Datetime() {
                    var x = new Date()
                    var x1 = padLeft(x.getDate(), 2) + "/" + padLeft(x.getMonth() + 1, 2) + "/" + x.getFullYear();
                    x1 = x1 + " - " + formatAMPM(x);
                    document.getElementById('datetimetimer').innerHTML = x1;
                    document.getElementById('datetimetimer').title = x.format('dddd, dd, MMMM, yyyy');
                    timer = timer_Datetime();
                }

                function Tab_OnClientDoubleClick(sender, args) {
                    var win = args.get_tab().correspondingWnd;
                    win.hide();

                    var tab = args.get_tab();

                    if (tab) {
                        tab.set_selected(false);
                    }
                }

                function formatAMPM(date) {
                    var hours = date.getHours();
                    var minutes = date.getMinutes();
                    var sec = padLeft(date.getSeconds(), 2);
                    var ampm = hours >= 12 ? 'pm' : 'am';
                    hours = hours % 12;
                    hours = hours ? hours : 12; // the hour '0' should be '12'
                    minutes = minutes < 10 ? '0' + minutes : minutes;
                    var strTime = hours + ':' + minutes + ':' + sec + ' ' + ampm;
                    return strTime;
                }

                //opening the window
                function Menu_OpenNewWindow(sender, args) {
                    var item = args.get_item();
                    var itemUrl = item.get_value();
                    var itemText = item.get_text();

                    var tabExists = tabStrip.findTabByText(itemText);

                    var width = args.get_item().get_attributes().getAttribute("Width");
                    var height = args.get_item().get_attributes().getAttribute("Height");
                    var posX = args.get_item().get_attributes().getAttribute("PosX");
                    var posY = args.get_item().get_attributes().getAttribute("PosY");
                    var page = args.get_item().get_attributes().getAttribute("Page");



                    if (page) {

                        if (page == "LoginOut.aspx") {

                            if (oWndloginOut == null) {
                                oWndloginOut = radopen(page, "LoginOut");
                                oWndloginOut.set_title(itemText);

                            }
                            else {
                                oWndloginOut.show();
                            }
                        }
                        else {

                            if (!tabExists) {

                                if (itemUrl) {
                                    var oWnd = radopen(itemUrl, null, width, height, posX, posY);
                                    oWnd.set_title(itemText);
                                    if (!posX && !posX) oWnd.center();
                                    tabStrip.trackChanges();
                                    //create a new tab
                                    var tab = new Telerik.Web.UI.RadTab();
                                    //set the text of the tab
                                    tab.set_text(itemText);
                                    oWnd.correspondingTab = tab;
                                    //add the tab to the tabstrip
                                    tabStrip.get_tabs().add(tab);
                                    tabStrip.repaint();
                                    tab.correspondingWnd = oWnd;
                                    tab.set_imageUrl(item.get_imageUrl());
                                    tabStrip.commitChanges();

                                    //Select this tab
                                    tab.select();
                                }
                            }
                            else {
                                var win = tabExists.correspondingWnd;

                                if (!win.isVisible()) {
                                    win.show();
                                    win.restore();
                                    //if the window was maximized before client minimizes it, we need to restore
                                    //its maximized state
                                    if (win._Maximized) {
                                        win.maximize();
                                        win._Maximized = null;
                                    }

                                }
                                win.setActive(true);
                            }
                        }
                    }
                }

                function LoginOut_Close() {
                    oWndloginOut.close();
                    oWndloginOut = null;
                }

                function Windows_OnClientCommand(sender, args) {
                    //because we don't want to show the minimized RadWindow, we hide it after minimizing
                    //and raise the _Maximized flag (used in OnClientTabSelected)
                    if (args.get_commandName() == "Minimize") {
                        if (sender.isMaximized()) {
                            sender._Maximized = true;
                        }

                        sender.hide();
                        //raise the _toMinimize flag (used in OnClientActivate)
                        sender._toMinimize = true;
                        var tab = sender.correspondingTab;
                        if (tab) {
                            tab.set_selected(false);
                        }
                    }
                }

                function Tab_OnClientTabSelected(sender, args) {
                    //get a reference to the corresponding window
                    var win = args.get_tab().correspondingWnd;

                    if (!win) return;

                    if (!win.isVisible()) {
                        win.show();
                        win.restore();
                        //if the window was maximized before client minimizes it, we need to restore
                        //its maximized state
                        if (win._Maximized) {
                            win.maximize();
                            win._Maximized = null;
                        }

                    }
                    win.setActive(true);
                }

                function Windows_OnClientActivate(sender, args) {
                    var tab = sender.correspondingTab;
                    if (tab && !sender._toMinimize) {
                        tab.set_selected(true);
                    }
                    sender._toMinimize = false;
                }

                function Windows_OnClientClose(oWnd) {

                    //remove the corresponding tab from the tabstrip
                    var tab = oWnd.correspondingTab;
                    if (tab) {
                        tabStrip.trackChanges();
                        tabStrip.get_tabs().remove(tab);
                        tabStrip.commitChanges();
                    }
                }

                
            </script>
        </telerik:RadScriptBlock>


        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                // <![CDATA[
                var WinManager = null;
                var tabStrip = null;
                var datetime = null;

                function pageLoad() {
                    //get a reference to the needed controls -
                    WinManager = $find("<%=RadWindowManager1.ClientID %>");
                    tabStrip = $find("<%=RadTabStrip1.ClientID %>");

                    // timer
                    display_Datetime();
                }
                // ]]>
            </script>
        </telerik:RadCodeBlock>
</head>
<body class="desktop-Background" style="overflow: hidden">
    <form id="form2" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager2" runat="server"></telerik:RadScriptManager>
        <div id="bar">
            <div id="startmenu">
                <telerik:RadMenu ID="rmMenu" runat="server" OnClientItemClicking="Menu_OpenNewWindow" Style="z-index: initial;" Width="100%">
                    <Items>
                        <telerik:RadMenuItem Text="Menu">
                            <GroupSettings ExpandDirection="Up" Flow="Vertical"></GroupSettings>
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>
            </div>
            <div id="taskbar">
                <telerik:RadTabStrip OnClientTabSelected="Tab_OnClientTabSelected" OnClientDoubleClick="Tab_OnClientDoubleClick" ID="RadTabStrip1"
                    ScrollButtonsPosition="Middle" ScrollChildren="True" Width="100%" CssClass="taskbar"
                    Orientation="HorizontalBottom" runat="server" SelectedIndex="0">
                    <Tabs>
                        <telerik:RadTab Style="display: none;" Selected="True"></telerik:RadTab>
                    </Tabs>
                </telerik:RadTabStrip>
            </div>
            <div id="taskbarDatetime">
                <span id='datetimetimer' title="Fecha"></span>
            </div>
        </div>
        <div id="desktop">
            <div class="bottom metro">
                <h1 class="fg-white">
                <span runat="server" id="lblCompany" class="fg-white"></span>
                </h1>
            </div>
       
        <div id="company">                   
            <telerik:RadBinaryImage ID="CompanyLogoPreviewImage" runat="server" />         
        </div>
         </div>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" ShowOnTopWhenMaximized="false" EnableShadow="true" Behaviors="Move,Close,Resize, Minimize,Reload"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Height="570px" Width="1024px"
            OnClientActivate="Windows_OnClientActivate" OnClientClose="Windows_OnClientClose" OnClientCommand="Windows_OnClientCommand" RestrictionZoneID="desktop">           
        </telerik:RadWindowManager>        
    </form>
</body>
</html>

